<?php

class Admin_model extends CI_Model {
	
	protected $table;

	function __construct(){
		parent::__construct();
		$this->table = 'admin';
	}

	
	
	function connect($login , $pass){
		$res = $this->db->get_where($this->table, array('login'=>$login));
		if($res->num_rows == 1){
			$this->load->library('encrypt');
			$res = $res->result_array();
			if ($pass == $this->encrypt->decode($res[0]['password']))
				return $res[0];
			else
				return null;
		}
		else{
			return null;
		}
	}
}